﻿@namespace Masa.Blazor
@using StyleBuilder = Masa.Blazor.Core.StyleBuilder
@inherits ThemeComponentBase

<CascadingValue Value="ComputedTheme" Name="MasaBlazorCascadingTheme">
    <div class="@GetClass()" style="@GetStyle()" id="@Id" @ref="Ref" @attributes="Attributes">
        <div class="@_block.Element("body")">
            @ChildContent
        </div>

        <div class="@_block.Element("divider")">
            @if (!HideDot)
            {
                <div class="@_dotModifierBuilder.Add(Small, Large)">
                    <div class="@GetClass(_block.Element("inner-dot").Name, CssClassUtils.GetBackgroundColor(Color))"
                         style="@(StyleBuilder.Create().AddBackgroundColor(Color))">
                        @if (IconContent is not null)
                        {
                            @IconContent
                        }
                        else if (!string.IsNullOrWhiteSpace(Icon))
                        {
                            <MIcon Color="@IconColor"
                                   Dark="@(!IsDark)"
                                   Small="@Small">
                                @Icon
                            </MIcon>
                        }
                    </div>
                </div>
            }
        </div>

        @if (OppositeContent != null)
        {
            <div class="@_block.Element("opposite")">
                @OppositeContent
            </div>
        }
    </div>
</CascadingValue>